<?php

function smarty_function_get( $params, Smarty &$smarty )
{
	$_r = '';
	
	$attributes = array( );
	foreach( $params as $_k => $_v )
	if( strpos( ',model,id,value,assign,append', $_k ) !== false )
	{
		if( strlen( $_v ) ) $$_k = $_v;
	}
	else
	{
		$attributes[ $_k ] = $_v;
	}
	
	
	if( !isset( $model ) || !isset( $id ) )
	{
		$_r = '^%#@!!@#$!@#%!';
	}
	else
	{
		$o = new $model( );
		$_r = $o ->get( $id );
		if( isset( $value ) ) $_r = $_r[ $value ];
	}
	
	if( isset( $params['assign'] ) )
	{
		$smarty ->assign( $params['assign'] , $_r );
		
	}
	elseif( isset( $append ) )
	{
		$smarty ->append( $append, $_r );
	}
	else 
	{
		return $_r;
	}
    
}



?>